import request from '@/utils/request'

// 查询餐台列表
export function listTable(query) {
  return request({
    url: '/restaurant/table/list',
    method: 'get',
    params: query
  })
}

// 查询所有餐台（不分页）
export function listAllTable(query) {
  return request({
    url: '/restaurant/table/all',
    method: 'get',
    params: query
  })
}

// 查询餐台详细
export function getTable(id) {
  return request({
    url: '/restaurant/table/' + id,
    method: 'get'
  })
}

// 新增餐台
export function addTable(data) {
  return request({
    url: '/restaurant/table',
    method: 'post',
    data: data
  })
}

// 修改餐台
export function updateTable(data) {
  return request({
    url: '/restaurant/table',
    method: 'put',
    data: data
  })
}

// 删除餐台
export function delTable(ids) {
  return request({
    url: '/restaurant/table/' + ids,
    method: 'delete'
  })
}

// 开台
export function openTable(data) {
  return request({
    url: '/restaurant/table/open',
    method: 'post',
    data: data
  })
}

// 换台
export function changeTable(data) {
  return request({
    url: '/restaurant/table/change',
    method: 'post',
    data: data
  })
}

// 预定餐台
export function reserveTable(data) {
  return request({
    url: '/restaurant/table/reserve',
    method: 'post',
    data: data
  })
}

// 结账
export function checkoutTable(id) {
  return request({
    url: '/restaurant/table/checkout/' + id,
    method: 'post'
  })
}

// 初始化餐台数据
export function initializeTables() {
  return request({
    url: '/restaurant/table/initialize',
    method: 'post'
  })
}

